package com.fla.shapeevader.model;

import android.graphics.PointF;
import android.graphics.RectF;

public class BaseShape {
    private RectF bounds;
    private Trajectory trajectory;

    private float fullWidth;
    private float fullHeight;

    public BaseShape(PointF start, float width, float height, Trajectory trajectory) {
        this.trajectory = trajectory;
        this.bounds = new RectF(start.x, start.y, start.x + width, start.y + height);
    }

    public void setSize(float fullWidth, float fullHeight) {
        this.fullWidth = fullWidth;
        this.fullHeight = fullHeight;
    }

    public void makeMove() {
        bounds.offset(trajectory.getDx(), trajectory.getDy());

        // after offseting it is not guaranted that no one if will be executed
        trajectory.recalculateParams(bounds, fullWidth, fullHeight);
    }

    public RectF getBounds() {
        return bounds;
    }

    public Trajectory getTrajectory() {
        return trajectory;
    }
}
